# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=libsoup

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=2.46.0
pkgrel=1
pkgdesc="HTTP client/server library (mingw-w64)"
arch=(any)
url="http://ftp.gnome.org/pub/GNOME/sources/libsoup"
license=("LGPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config" "${MINGW_PACKAGE_PREFIX}-gobject-introspection" "intltool")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
    "${MINGW_PACKAGE_PREFIX}-glib2"
    "${MINGW_PACKAGE_PREFIX}-libxml2"
    "${MINGW_PACKAGE_PREFIX}-sqlite3"
    "${MINGW_PACKAGE_PREFIX}-glib-networking")
options=('staticlibs' 'strip')
source=("http://ftp.gnome.org/pub/gnome/sources/${_realname}/${pkgver%.*}/${_realname}-$pkgver.tar.xz"
    0001-give-cc-to-gir-scanner.mingw.patch)
md5sums=('86765c0093efaf3006fa2960d170d097'
         'a1ddc19ab3f73bbddda1d41a6a7de399')

prepare() {
  cd "$srcdir/${_realname}-$pkgver"
  patch -p1 -i ${srcdir}/0001-give-cc-to-gir-scanner.mingw.patch
  
  autoreconf -fi
}

build() {
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  "${srcdir}"/${_realname}-$pkgver/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --without-apache-httpd \
    --without-apache-module-dir \
    --with-gnome \
    --enable-introspection
  make -j1
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="$pkgdir" install
}
